$(function () {
    var html_data = {
        have_alipay: '',
        alipay: '',
        password: '',
        sessionid: '',
        sessionid_q: '',
        bank_name: '',
        user_name: '',
        card_no: '',
        bank:{},
        bank_list:[
            {id:'0100', name:'中国邮政储蓄'},
            {id:'0102', name:'工商银行'},
            {id:'0103', name:'农业银行'},
            {id:'0104', name:'中国银行'},
            {id:'0105', name:'建设银行'},
            {id:'0301', name:'交通银行'},
            {id:'0302', name:'中信银行'},
            {id:'0303', name:'光大银行'},
            {id:'0304', name:'华夏银行'},
            {id:'0305', name:'民生银行'},
            {id:'0306', name:'广发银行'},
            {id:'0308', name:'招商银行'},
            {id:'0309', name:'兴业银行'},
            {id:'0310', name:'浦发银行'},
            {id:'0318', name:'平安银行'},
            {id:'0403', name:'北京银行'},
            {id:'0408', name:'宁波银行'},
        ]
    };
    var app = new Vue({
        el: '#host_alipy',
        data: html_data,
        methods: {
            save_alipay: function () {
                api.sys.save_host_alipay({
                    user_name: html_data.bank.username,
                    card_no: html_data.bank.card_no,
                    bank_no: html_data.bank.bank_no
                }).then(function (data) {
                    Magiclamp.mcAlert("提示", "提现时钱将转入"+html_data.bank.card_no,null, function () {
                        baseConfig.page_back();
                    });

                });
            },
            page_back: function () {
                baseConfig.page_back();
            }
        }
    });

    html_data.sessionid = GetQueryString('sessionid');
    if (html_data.sessionid) {
        html_data.sessionid_q = "sessionid=" + html_data.sessionid;
        client_storage('sessionid', html_data.sessionid);
    }

    api.sys.get_host_alipay().then(function (data) {
        if (data.result.user_name) {
            for(var i=0;i<html_data.bank_list.length;i++){
                if(html_data.bank_list[i].id==data.result.bank_no){
                    html_data.bank_name = html_data.bank_list[i].name;
                    html_data.user_name = data.result.user_name;
                    html_data.card_no = data.result.card_no;
                }
            }

        }
    })

});